package com.faryangsh.es5api_learn.bean;

import com.faryangsh.es5api_learn.constans.AppConstans;
import com.fasterxml.jackson.annotation.*;
import lombok.*;
import org.apache.http.client.utils.DateUtils;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

/**
 * @author 杨志远[OF2551]
 * company qianmi.com
 * Date    2017-10-26
 */
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ToString
@Data
public class Person {
    //使用 @JsonIgnore 在JSON序列化时，忽略此字段
    @JsonIgnore
    final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");


    /*    @Getter
    @Setter*/
    private String name;

/*    @Getter
    @Setter*/
    private int age;

    private LocalDate born;

    @JsonGetter
    public String getBorn(){
        return this.born.format(AppConstans.formatter);
    }

    /*public void setBorn(String born){
        this.born = LocalDate.parse(born, formatter);
    }*/

}
